package com.xqt.base.page;

import java.io.Serializable;

public class BasePage implements Serializable {

	/**  */
	private static final long serialVersionUID = -6085540357615162269L;

	private int pageId = 1; // 当前页
	private int pageOffset = 0;// 当前页起始记录
	private int pageSize = 10; // 页大小
	private int pageCount = 0; // 总页数
	private int rowCount = 0; // 总条数
	private boolean limitDirection = true; // 是否需要分页
	private String orderField;

	public int getPageId() {
		return pageId;
	}

	public void setPageId(int pageId) {
		this.pageId = pageId;
	}

	public int getPageOffset() {
		return pageOffset;
	}

	public void setPageOffset(int pageOffset) {
		this.pageOffset = pageOffset;
	}

	public int getPageSize() {
		return pageSize;
	}

	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}

	public boolean isLimitDirection() {
		return limitDirection;
	}

	public void setLimitDirection(boolean limitDirection) {
		this.limitDirection = limitDirection;
	}

	public String getOrderField() {
		return orderField;
	}

	public void setOrderField(String orderField) {
		this.orderField = orderField;
	}
	
	public int getPageCount() {
		return pageCount;
	}
	
	public void setPageCount(int pageCount) {
		this.pageCount = this.rowCount / this.pageSize + (this.rowCount % this.pageSize == 0 ? 0 : 1);
		if (this.pageCount == 0) {
			if (this.rowCount == 0) {
				this.pageCount = 0;
			} else {
				this.pageCount = 1;
			}
		}
	}

	public int getRowCount() {
		return rowCount;
	}

	public void setRowCount(int rowCount) {
		this.rowCount = rowCount;
	}
	
}
